home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / GMS / Source / Asm / Fading / Morph.s < prev    next >
Encoding:
Text File  |  1997-05-01  |  3.2 KB  |  138 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;AGA Palette Morph
  3. ;-----------------
  4. ;Fades in a 32 colour AGA picture (24 bit colour).  Then fades it into
  5. ;a second purple palette, and then out to black.
  6. ;
  7. ;Press left mouse button to exit.
  8.  
  9.     INCDIR    "INCLUDES:"
  10.     INCLUDE    "games/games_lib.i"
  11.     INCLUDE    "games/games.i"
  12.  
  13. CALL    MACRO
  14.     jsr    _LVO\1(a6)
  15.     ENDM
  16.  
  17.     SECTION    "AGAFade",CODE
  18.  
  19. ;===========================================================================;
  20. ;                             INITIALISE DEMO
  21. ;===========================================================================;
  22.  
  23.     STARTGMS
  24.  
  25. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  26.     move.l    GMSBase(pc),a6
  27.     lea    ScreenTags(pc),a0
  28.     CALL    AddScreen
  29.     tst.l    d0
  30.     beq.s    .Error_Screen
  31.  
  32.     move.l    Screen(pc),a0
  33.     lea    PictureTags(pc),a1
  34.     move.l    GS_MemPtr1(a0),PicData
  35.     CALL    LoadPic
  36.     tst.l    d0
  37.     beq.s    .Error_Picture
  38.  
  39.     CALL    ShowScreen
  40.  
  41.     bsr.s    Main
  42.  
  43. .ReturnToDOS
  44.     move.l    GMSBase(pc),a6
  45.     move.l    Picture(pc),a1
  46.     CALL    FreePic
  47. .Error_Picture
  48.     move.l    Screen(pc),a0
  49.     CALL    DeleteScreen
  50. .Error_Screen
  51.     MOVEM.L    (SP)+,A0-A6/D1-D7
  52.     moveq    #ERR_OK,d0
  53.     rts
  54.  
  55. ;===========================================================================;
  56. ;                                MAIN CODE
  57. ;===========================================================================;
  58.  
  59. Main:    move.l    Screen(pc),a0
  60.     move.l    Picture(pc),a1
  61.     move.l    PIC_Palette(a1),a1    ;a1 = Palette to fade to.
  62.     moveq    #$00,d0    ;d0 = FadeState
  63.     moveq    #5,d1    ;d1 = Speed of fade.
  64.     moveq    #$000000,d2
  65.     moveq    #00,d3
  66.     move.l    GS_AmtColours(a0),d4
  67. .f_in    CALL    WaitVBL
  68.     CALL    ColourToPalette    ;Do the fade routine.
  69.     tst.w    d0    ;Has the fade finished yet?
  70.     bne.s    .f_in    ;If not, keep doing it.
  71.  
  72.     moveq    #50,d0
  73.     CALL    WaitTime
  74.  
  75.     moveq    #$00,d0    ;d0 = FadeState
  76.     moveq    #2,d1    ;d1 = Speed of fade.
  77.     lea    MorphPalette(pc),a2    ;a2 = Destination Palette.
  78. .f_mid    CALL    WaitVBL
  79.     CALL    PaletteMorph    ;Do the fade routine.
  80.     tst.w    d0    ;Has the fade finished yet?
  81.     bne.s    .f_mid    ;If not, keep doing it.
  82.  
  83.     moveq    #50,d0
  84.     CALL    WaitTime
  85.  
  86.     moveq    #$00,d0    ;d0 = FadeState
  87.     moveq    #2,d1    ;d1 = Speed of fade.
  88.     lea    MorphPalette(pc),a1
  89.     moveq    #$000000,d2
  90. .f_out    CALL    WaitVBL
  91.     CALL    PaletteToColour    ;Do the fade routine.
  92.     tst.w    d0    ;Has the fade finished yet?
  93.     bne.s    .f_out    ;If not, keep doing it.
  94.  
  95.     moveq    #50,d0
  96.     CALL    WaitTime
  97.     rts
  98.  
  99. ;===========================================================================;
  100. ;                                  DATA
  101. ;===========================================================================;
  102.  
  103. ScreenTags:
  104.     dc.l    TAGS_GAMESCREEN
  105. Screen:    dc.l    0
  106.     dc.l    GSA_AmtColours,32
  107.     dc.l    GSA_ScrWidth,320
  108.     dc.l    GSA_ScrHeight,256
  109.     dc.l    GSA_Planes,5
  110.     dc.l    GSA_ScrMode,LORES
  111.     dc.l    TAGEND
  112.  
  113. MorphPalette:
  114.     dc.l    $000000,$0A0107,$14020E,$1D0314
  115.     dc.l    $27041B,$310522,$3B0629,$45082F
  116.     dc.l    $4E0936,$580A3D,$620B44,$6C0C4A
  117.     dc.l    $760D51,$800E58,$890F5F,$931066
  118.     dc.l    $9D116C,$A71273,$B1137A,$BA1481
  119.     dc.l    $C41687,$CE178E,$D81895,$E2199C
  120.     dc.l    $EB1AA2,$F51BA9,$FF1CB0,$D71C9F
  121.     dc.l    $557D55,$707082,$443300,$1E1E1E
  122.  
  123. PictureTags:
  124.     dc.l    TAGS_PICTURE
  125. Picture    dc.l    0
  126.     dc.l    PCA_Data
  127. PicData    dc.l    0
  128.     dc.l    PCA_Width,320
  129.     dc.l    PCA_Height,256
  130.     dc.l    PCA_Planes,5
  131.     dc.l    PCA_AmtColours,32
  132.     dc.l    PCA_ScrMode,LORES
  133.     dc.l    PCA_Options,GETPALETTE
  134.     dc.l    PCA_File,.file
  135.     dc.l    TAGEND
  136. .file    dc.b    "GMS:demos/data/PIC.Loading",0
  137.     even
  138.